import { Plugin } from "../../core";
import { CSSProperties, ReactElement } from "react";

export interface HighlightArea {
  height: number;
  left: number;
  pageIndex: number;
  top: number;
  width: number;
}

export interface SelectionData {
  startPageIndex: number;
  endPageIndex: number;
  startOffset: number;
  startDivIndex: number;
  endOffset: number;
  endDivIndex: number;
}

export interface RenderHighlightTargetProps {
  highlightAreas: HighlightArea[];
  selectedText: string;
  selectionRegion: HighlightArea;
  selectionData: SelectionData;
  cancel(): void;
  // Switch to the hightlighting state
  toggle(): void;
}

export interface RenderHighlightContentProps {
  highlightAreas: HighlightArea[];
  selectedText: string;
  selectionRegion: HighlightArea;
  selectionData: SelectionData;
  cancel(): void;
}

export interface RenderHighlightsProps {
  getCssProperties(area: HighlightArea, rotation: number): CSSProperties;
  pageIndex: number;
  rotation: number;
}

export interface HighlightPlugin extends Plugin {
  jumpToHighlightArea(area: HighlightArea): void;
}

export interface HighlightPluginProps {
  renderHighlightTarget?(props: RenderHighlightTargetProps): ReactElement;
  renderHighlightContent?(props: RenderHighlightContentProps): ReactElement;
  renderHighlights?(props: RenderHighlightsProps): ReactElement;
}
